program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;

type
  pelement=^element;
  element=record
    next: pelement;
    value: integer;
  end;
procedure AddStart(var head: pelement; num: integer);
var
  tmp: pelement;
begin
  tmp:=head;
  new(head);
  head^.next:=tmp;
  head^.value:=num;
end;
procedure Print(head: pelement);
var
  current: pelement;
begin
  current:=head;
  while(current<>nil) do
  begin
    writeln(current^.value);
    current:=current^.next;
  end;
end;
procedure DelFour(var head: pelement);
var
  current, tmp: pelement;
  i: integer;
begin
  if (head^.next^.next^.next<>nil) then
    begin
      current:=head;
      for i:=1 to 2 do
      begin
        current:=current^.next;
      end;
      tmp:=current^.next^.next;
      dispose(current^.next);
      current^.next:=tmp;
      Print(head);
    end;
  if (head^.next^.next^.next=nil) then
    writeln ('Very bad');
end;

var
  head: pelement;
  num, n, i: integer;
  fin: textfile;
begin
  assignfile(fin, 'input.txt');
  reset(fin);
  head:=nil;
  readln(fin, n);
  for i:=0 to n-1 do
  begin
    readln(fin, num);
    AddStart(head, num);
  end;
  DelFour(head);
  readln;
end.
 